package com.qianren.edu.viewmodel;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
 * JS Tree View Model
 * 
 * @author Jeff
 * 
 */
public class JsTree {
	public final static String ATTR_ID = "id";
	public final static String STATE_OPEN = "open";
	public final static String STATE_CLOSED = "closed";

	private String data;
	private String state;
	private HashMap<String, String> attr = new HashMap<String, String>();
	private List<JsTree> children = new ArrayList<JsTree>();

	public String getData() {
		return data;
	}

	public void setData(String data) {
		this.data = data;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public HashMap<String, String> getAttr() {
		return attr;
	}

	public void setAttr(HashMap<String, String> attr) {
		this.attr = attr;
	}

	public void addAttr(String key, String value) {
		this.attr.put(key, value);
	}

	public List<JsTree> getChildren() {
		return children;
	}

	public void setChildren(List<JsTree> children) {
		this.children = children;
	}

	public void addChildren(JsTree jsTree) {
		this.children.add(jsTree);
	}

}
